home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 2 / Gekikoh Dennoh Club Vol. 2 (Japan).7z / Gekikoh Dennoh Club Vol. 2 (Japan) (Track 01).bin / kowin / font / tcwin24s.lzh / OK.c < prev    next >
C/C++ Source or Header  |  1991-01-28  |  2KB  |  114 lines

  1. /*
  2.     Ko-Windowライブラリ  1990 by 小笠原博之 SPS0783 COR.
  3. */
  4.  
  5. #include    <stdio.h>
  6. #include    <wlib.h>
  7. #include    <parts.h>
  8.  
  9. static    char    *str;
  10. static    char    *str2;
  11.  
  12. static int    OKexec();
  13. static int    INPexec();
  14.  
  15. OK( msg1, msg2 )
  16. char    *msg1;
  17. char    *msg2;
  18. {
  19.     EventInfo    Info;
  20.     WindowID    wp;
  21.     ClipClass    yes,
  22.             no;
  23.  
  24.     str= msg1;
  25.     str2= msg2;
  26.  
  27.     wp = WindowSimpleOpen( 234, 200, 300, 80, NULL, OKexec );
  28.     WindowRedraw( wp );
  29.  
  30.     ClipSet( &yes, 60-30, 50-4, 60, 24 );
  31.     ClipSet( &no, 240-30, 50-4, 60, 24 );
  32.  
  33.     for(;;){
  34.         WindowGetEventInfo( &Info );
  35.         if( Info.LeftStat && WindowGetChild( WindowRootID, &Info ) == wp ){
  36.             if( ClipInner( &yes, Info.x, Info.y ) ){
  37.                 WindowClose( wp );
  38.                 return    TRUE;
  39.             }else if ( ClipInner( &no, Info.x, Info.y ) ){
  40.                 WindowClose( wp );
  41.                 return    FALSE;
  42.             }
  43.         }
  44.     }
  45. }
  46.  
  47. static
  48. OKexec( wp, info )
  49. WindowID    wp;
  50. EventInfo    *info;
  51. {
  52.     DrawBuf        buf[10];
  53.  
  54.     switch( info->option ){
  55.         case EventRedraw:
  56.             DrawSetClear( buf, 1 );
  57.             DrawSetSymbol( buf+1, 30, 4, str, AttrDefault, 12 );
  58.             DrawSetSymbol( buf+2, 30, 6+12, str2, AttrDefault, 12 );
  59.             DrawSetSymbol( buf+3, 60-24, 50, "YES", AttrDefault, 16 );
  60.             DrawSetSymbol( buf+4, 240-16, 50, "NO", AttrDefault, 16 );
  61.             DrawSetLine( buf+5, 60-30, 50-4, 60+30, 50+20, ShadowDown, OptionShadow );
  62.             DrawSetLine( buf+6, 240-30, 50-4, 240+30, 50+20, ShadowDown, OptionShadow );
  63.             WindowDraw( wp, buf, 7 );
  64.             break;
  65.     }
  66.     return    TRUE;
  67. }
  68.  
  69. static    InputClass    input;
  70.  
  71. lineinput( ibuf )
  72. char    *ibuf;
  73. {
  74.     EventInfo    Info;
  75.     WindowID    wp;
  76.     int        i;
  77.  
  78.     InputSet( &input, 4, 4, ibuf, 37, 9, 16 );
  79.     wp = WindowSimpleOpen( 234, 200, 300, 22, NULL, INPexec );
  80.     WindowRedraw( wp );
  81.  
  82.     *ibuf= '\0';
  83.  
  84.     for(;;){
  85.         if( WindowGetEventInfo( &Info ) ){
  86.             DrawBuf    buf[10];
  87.             if( Info.KeyCode ){
  88.                 if( Info.KeyCode == 13 ){
  89.                     WindowClose( wp );
  90.                     return;
  91.                 }
  92.                 WindowDraw( wp, buf, InputKey(buf, &input, Info.KeyCode, Info.ShiftStat) );
  93.             }
  94.         }
  95.     }
  96. }
  97.  
  98. static
  99. INPexec( wp, info )
  100. WindowID    wp;
  101. EventInfo    *info;
  102. {
  103.     DrawBuf        buf[12];
  104.  
  105.     switch( info->option ){
  106.         case EventRedraw:
  107.             DrawSetClear( buf, 1 );
  108.             DrawSetLine( buf+1, 2, 2, 298, 20, ShadowDown, OptionShadow );
  109.             WindowDraw( wp, buf, 2+InputSetDraw( buf+2, &input ) );
  110.     }
  111.     return    TRUE;
  112. }
  113.  
  114.